package com.yunmang.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;

import com.yunmang.R;
import com.yunmang.activity.statictis.SavingQueryStatictics;
import com.yunmang.activity.statictis.SendStatictics;
import com.yunmang.activity.statictis.SignedStatics;
import com.yunmang.adapter.MyGridViewAdapter;
import com.yunmang.entity.MyItemInfoBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * 作者 : bean on 2017/4/5/0005.
 * 注释 :报表
 */
public class StatementFragment extends BaseFragment implements AdapterView.OnItemClickListener {

    @InjectView(R.id.gridview)
    GridView gridview;
    private MyGridViewAdapter adapter;
    private List<MyItemInfoBean> list;
    @Override
    public int getLayoutId() {
        return R.layout.fragment_statement;
    }

    @Override
    public void initView(View view) {
        ButterKnife.inject(this, view);
    }

    @Override
    public void initData() {
        list=new ArrayList<>();
        list.add(new MyItemInfoBean(R.mipmap.icon_login_mima,"发货统计",""));
        list.add(new MyItemInfoBean(R.mipmap.icon_login_name,"已提统计",""));
        list.add(new MyItemInfoBean(R.mipmap.icon_sy_dh,"库存统计",""));
        adapter=new MyGridViewAdapter(context,list);
        gridview.setAdapter(adapter);
        gridview.setOnItemClickListener(this);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.reset(this);
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        switch (i){
            case 0:
                startActivity(new Intent(getActivity(), SendStatictics.class));
                break;
            case 1:
                startActivity(new Intent(getActivity(),SignedStatics.class));
                break;
            case 2:
                startActivity(new Intent(getActivity(),SavingQueryStatictics.class));
                break;
        }
    }
}
